<template>
  <div class="app-container calendar-list-container">

    <!-- 查询-->
    <el-card>
      <div class="block">
        <span style="color:gray; font-size:16px"> 对账时间: </span>
        <el-date-picker v-model="ReconciliationsQuery.value2" value-format="yyyy-MM-dd" align="right" type="date" placeholder="选择日期" :picker-options="pickerOptions1">
        </el-date-picker>
        <el-button size="mini" class="filter-item" type="primary" icon="el-icon-search" @click="init">执行</el-button>
      </div>
    </el-card>

<!--    <el-card>-->
<!--      <el-button size="medium" type="primary">机构端</el-button>-->
<!--      &lt;!&ndash; 查询结果 &ndash;&gt;-->
<!--      <div style="margin-bottom: 10px"></div>-->
<!--      <el-table size="small" :data="list" v-loading.body="listLoading" id="reconciliationsTable" element-loading-text="加载中" border fit highlight-current-row>-->

<!--        <el-table-column align="center" min-width="100" prop="source">-->
<!--        </el-table-column>-->

<!--        <el-table-column align="center" label="总笔数" prop="totalCount">-->
<!--        </el-table-column>-->
<!--        <el-table-column align="center" label="总金额" prop="totalFee">-->
<!--        </el-table-column>-->
<!--      </el-table>-->
<!--    </el-card>-->
    <div style="margin-bottom: 10px"></div>

<!--    <el-card>-->
<!--      <el-button size="medium" type="primary">各渠道</el-button>-->
<!--      <div style="margin-bottom: 10px"></div>-->
      <!-- 查询结果 -->
<!--      <el-table size="small" :data="listChannel" v-loading.body="listChannelLoading" id="reconChannelTable" element-loading-text="加载中" border fit highlight-current-row>-->

<!--        <el-table-column align="center" min-width="100" prop="source">-->
<!--        </el-table-column>-->

<!--        <el-table-column align="center" label="总金额">-->
<!--          <el-table-column align="center" label="平台" prop="totalPlatModeFee"></el-table-column>-->
<!--          <el-table-column align="center" label="机构" prop="totalOrgModeFee"></el-table-column>-->
<!--        </el-table-column>-->

<!--        <el-table-column align="center" label="总笔数">-->
<!--          <el-table-column align="center" label="平台" prop="totalPlatModeCount"></el-table-column>-->
<!--          <el-table-column align="center" label="机构" prop="totalOrgModeCount"></el-table-column>-->
<!--        </el-table-column>-->

<!--        <el-table-column align="center" label="结果">-->
<!--          <template slot-scope="scope">-->
<!--            <div>{{ scope.row.totalPlatModeFee == scope.row.totalOrgModeFee && scope.row.totalPlatModeCount == scope.row.totalOrgModeCount ? "帐平" : "帐不平"}}</div>-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--      </el-table>-->
<!--    </el-card>-->

  </div>
</template>

   <script>
import { doSynch } from '@/api/Reconciliations'
// import debounce from 'lodash/debounce'
export default {
  name: 'reconciliationsResult',
  data() {
    return {
      flag: '',
      listChannel: null,
      ReconciliationsQuery: {
        value2: '',
        orgId: this.orgId
      },
      listLoading: false,
      listChannelLoading: false,
      list: null,
      pickerOptions1: {
        disabledDate(time) {
          return time.getTime() > Date.now()
        },
        shortcuts: [
          {
            text: '今天',
            onClick(picker) {
              picker.$emit('pick', new Date())
            }
          },
          {
            text: '昨天',
            onClick(picker) {
              const date = new Date()
              date.setTime(date.getTime() - 3600 * 1000 * 24)
              picker.$emit('pick', date)
            }
          },
          {
            text: '一周前',
            onClick(picker) {
              const date = new Date()
              date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
              picker.$emit('pick', date)
            }
          }
        ]
      }
    }
  },
  created() {
    // this.getList()
  },
  methods: {
    init() {
      console.log(this.ReconciliationsQuery.value2)
      if (this.ReconciliationsQuery.value2 === '') {
        this.$message({
          message: '提示，请选择日期',
          type: 'warning'
        })
      } else {
        this.getList()
      }
    },
    getList() {
      this.listLoading = true
      this.listChannelLoading = true
      console.log(this.ReconciliationsQuery.value2)
      doSynch(this.ReconciliationsQuery).then(res => {
        this.flag = res.data.flag
        if (this.flag === false) {
          this.$message({
            message: '提示，今日已执行对账了哦',
            type: 'warning'
          })
        } else {
          this.$message({
            message: '后台正在执行，请稍后。。',
            type: 'success'
          })
        }
      })
    }
  }
}
</script>

   <style>
</style>
